/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package at.fhj.itm.refactor.report;

/**
 *
 * @author Seuchter
 */
public class ReportItem implements Comparable<ReportItem>{
    private ReportSeverity serverity;
    private String title;
    private String explanation;

    public ReportItem(final ReportSeverity serverity,
            final String title, final String explanation) {
        this.serverity = serverity;
        this.title = title;
        this.explanation = explanation;
    }



    public static ReportItem createInformation(String title, String message){
    	return new ReportItem(ReportSeverity.INFORMATION,  title, message);
    }
    public static ReportItem createRefactoringStep(String title, String message){
    	return new ReportItem(ReportSeverity.REFACTORING_STEP, title, message);
    }
    public static ReportItem createWarning(String title, String message){
    	return new ReportItem(ReportSeverity.WARNING, title, message);
    }
    public static ReportItem createError(String title, String message){
    	return new ReportItem(ReportSeverity.ERROR, title, message);
    }
    public String getExplanation() {
        return explanation;
    }

    public ReportSeverity getServerity() {
        return serverity;
    }

    public String getTitle(){
        return title;
    }

    public int compareTo(ReportItem t) {
        int result = t.getServerity().weight - getServerity().weight;

        if(result != 0){
            return result;
        }

        result = getTitle().compareTo(t.getTitle());
        return result;
    }


}
